<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <h1>宠物添加</h1>
  <input type="text" placeholder="种类" v-model="pet.type">
  <input type="text" placeholder="数量" v-model="pet.num">
  <input type="text" placeholder="品种" v-model="pet.breed">
  <input type="button" @click="insert()" value="添加">
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
 <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
     <script>
         let v = new Vue({
             el:"body>div",
             data:{
                 pet:{
                   type:"",
                   num:"",
                   breed:""
                 }
             },
             methods:{
                 insert(){
                   axios.post("/insert",v.pet).then(function (response) {
                     alert("添加成功")
                     location.href="/"
                   })
                 }
             }

         })
     </script>
</body>
</html>